package com.changpay.zywy.adapter

import android.content.Context
import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ruffian.library.widget.RTextView
import com.changpay.zywy.R
import com.changpay.zywy.bean.FreezeMyBean


/**
 * Created by chenxz on 2018/4/22.
 */
class FreezeListAdapter(private val context: Context?, datas: MutableList<FreezeMyBean.FreezeListBean>) :
    BaseQuickAdapter<FreezeMyBean.FreezeListBean, BaseViewHolder>(R.layout.item_freeze, datas) {

    override fun convert(helper: BaseViewHolder?, item: FreezeMyBean.FreezeListBean?) {
        item ?: return
        helper ?: return
        helper.setText(R.id.tv_name,item.member_name).setText(R.id.tv_type,item.created_time)

        val textView =   helper.getView<RTextView>(R.id.tv_status)
        when (item.status)
        {
            0->  {
                textView.text = "冻结中"
                textView.helper.backgroundColorNormal = Color.parseColor("#FABF13")

            }
            1->  {
                textView.text = "已还款"
                textView.helper.backgroundColorNormal = Color.parseColor("#816003")

            }

            2->  {
                textView.text = "已取消"
                textView.helper.backgroundColorNormal = Color.parseColor("#816003")

            }
        }

    }

}
